<template>
  <div class="rank">
    <h4 class="title">{{ title }}</h4>
    <ul class="list">
      <li :key="index" v-for="(item, index) in list">
        <div class="title_left">
          <span :class="index < 3 ? 'active' : null">{{ index + 1 }}</span>
          <span class="title2">
            <a class="textname">{{ item.goods_short_title }}</a>
          </span>
        </div>
        <span class="right">{{ item.num }}</span>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  name: "RankList",
  // ['title', 'list']
  props: {
    title: {
      type: String,
      default: ""
    },
    list: {
      type: Array,
      default: null
    }
  }
};
</script>

<style lang="less" scoped>
.rank {
  width: 100%;
  text-align: left;
  .title {
    margin-top: 0;
  }
  .list {
    // margin: 25px 0 0;
    padding: 0;
    list-style: none;

    li {
      width: 100%;
      display: inline-block;
      // overflow: hidden;
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin: 10px 0;
      .title_left {
        width: 100%;
        display: flex;
        justify-content: flex-start;
        align-items: center;
      }
      span {
        color: rgba(0, 0, 0, 0.65);
        font-size: 14px;
        line-height: 22px;

        &:first-child {
          background-color: #f5f5f5;
          border-radius: 50%;
          display: inline-block;
          font-size: 12px;
          font-weight: 600;
          margin-right: 20px;
          width: 20px;
          height: 20px;
          line-height: 20px;
          text-align: center;
        }

        &.active {
          background-color: #314659;
          color: #fff;
        }

        &:last-child {
          float: right;
        }
      }

      .title2 {
        display: inline-block;
        width: 80%;
        font-size: 14px;
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
        // line-height: 22px;

        .textname {
          overflow: hidden;
          width: 80%;
          line-height: 22px;
          white-space: nowrap;
          text-overflow: ellipsis;
        }
      }

      .right {
        float: right;
      }
    }
  }
}

@media screen and (min-width: 1206px) and (max-width: 1770px) {
  .rank {
    .title2 {
      width: 60% !important;
      .textname {
        width: 60% !important;
      }
    }
  }
}
@media screen and (min-width: 760px) and (max-width: 990px) {
  .rank {
    .title2 {
      width: 50% !important;
      .textname {
        width: 50% !important;
      }
    }
  }
}

// .mobile .rank {
//   padding: 0 32px 32px 32px;
// }
</style>
